home *** CD-ROM | disk | FTP | other *** search
- /* hypot.c function, from page 216 of turboc bible */
- #include<math.h>
- #include<stdio.h>
- #include<stdlib.h> /* errno is defined here */
- main(int argc, char **argv)
- {
- double x, y, result;
- if(argc < 3)
- {
- printf("Usage:%s <x> <y>\n", argv[0]);
- }
- else
- {
- x = atof(argv[1]);
- y = atof(argv[2]);
- result = hypot(x, y);
- if(errno != ERANGE)
- {
- printf("hypot(%s, %s) = %f\n",
- argv[1], argv[2], result);
- }
- }
- }